﻿// ==UserScript==
// @name           replace star by profile icon
// @namespace      http://ss-o.net/
// @include        http://*.hatena.ne.jp/*
// @checkurl       http://ss-o.net/userjs/replaceStarByProfileIcon.user.js
// @version        1.1
// ==/UserScript==

location.href = 'javascript:(' + function(){
(function(unsafeWindow){
    if (unsafeWindow && unsafeWindow.Hatena && unsafeWindow.Hatena.Star){
        var bindStarEntry = unsafeWindow.Hatena.Star.Entry.prototype.bindStarEntry;
     /* alert('bindStarEntry = '+bindStarEntry); */
        unsafeWindow.Hatena.Star.Entry.prototype.bindStarEntry = function(se){
          /* alert('se = '+se); */
            var self = this, stars = [];
            for (var i = 0,len = se.stars.length; i < len; i++) {
                var star = se.stars[i];
                if (star.name) {
                    alert('star.name = '+star.name);
                    var img = unsafeWindow.Hatena.User.getProfileIcon(star.name);
                    img.alt = star.name;
                    if (!star.img)
                        star.img = img;
                }
                stars.push(star);
            }
            se.stars = stars;
            bindStarEntry.call(self, se);
        };
        var showName = unsafeWindow.Hatena.Star.Star.prototype.showName;
     /* alert('showName = '+showName); */
        unsafeWindow.Hatena.Star.Star.prototype.showName = function(e){
         /* alert('this.name = '+this.name); */
            this.screen_name = this.name;
            showName.call(this,e);
        };
    }
})(this.unsafeWindow||window);
}.toString() + ')()';
